/**
 * Created by z on 2017/5/18.
 */

$(function(){
    $( "#tabs" ).tabs();
});

function getCode() {

    var phoneNum = $("#phoneNum").val();
    if(phoneNum==undefined || phoneNum==null || phoneNum==''){
        $("#phone-num-error").text("手机号不能为空");
    }else {
        $("#phone-num-error").text("");
    }
    $.ajax({
        type:"get",
        url:config.devUrl + "/user/getCode.json?phoneNum="+phoneNum,
        dataType:"json",
        success:function(data){

        }
    });
}

function alterLoginPassword(){
    var url = config.devUrl +"/user/modifyPassword.json";
    var param = {};
    param.userId = userId;
    param.oldPassword = oldPassword;
    param.newPassword = newPassword;
    getData(url,param);
}

function alterPayPassword(){
    var url = config.devUrl +"/user/modifyAccountPassword.json"
    var param = {};
    param.userId = userId;
    param.oldPayPassword = oldPayPassword;
    param.newPayPassword = oldPayPassword;
    getData(url,param);
}

function forgetPayPassword(){
    var url = config.devUrl +"/user/modifyAccountPassword.json"
    var param = {};
    param.userId = userId;
    param.phoneNum = phoneNum;
    param.code = code;
    param.newPayPassword = newPayPassword;
    getData(url,param);
}

function getData(url,param){
    $.ajax({
        type:"post",
        url:url,
        data:param,
        dataType:"json",
        success:function(data){
            if(data.status == '0'){
                alert("修改成功");
            }
        }
    });
}

